import React, { Component } from 'react';
import { connect, } from 'react-redux';
import { closeSherd, setSherd } from '../utils/utils'

class Sherd extends Component {

    constructor(props) {
        super(props)
        this.state = {

        }
    }

    onClose = () => {
        const { dispatch } = this.props
        closeSherd(dispatch)
    }

    render() {
        const { sherd } = this.props
        console.log(this)
        if (sherd) {
            return (
                <div className="sherd" onClick={this.onClose}>
                    <img src={require('../static/images/fx.png')} alt="" />
                    <div className="alert-mask"></div>
                </div>
            );
        }
        return null
    }
}


export default connect(({ user, sherd }) => ({ user, sherd }))(Sherd);

